package day12;

import java.util.Calendar;
import java.util.Date;

public class Calender_Demo {
    public static void main(String[] args) {
        Calendar  calendar=Calendar.getInstance();//Calendar 为抽象类 获取一个默认指定的日历对象
        System.out.println(calendar);
        int year = calendar.get(Calendar.YEAR);
        System.out.println(year);
        int month = calendar.get(Calendar.MONTH)+1;
        System.out.println(month);
        int day=calendar.get(Calendar.DATE);
        System.out.println(day);
        System.out.println(year+" "+month+" "+day);

        int hour=calendar.get(Calendar.HOUR);
        System.out.println(hour);

        int minute = calendar.get(Calendar.MINUTE);
        System.out.println(minute);
        int second=calendar.get(Calendar.SECOND);
        System.out.println(second);
        System.out.println(hour+" "+minute+" "+second);
        System.out.println(year+" "+month+" "+day+" "+hour+" "+minute+" "+second);
        Date time = calendar.getTime();
        System.out.println(time);

    }
}
